package com.shanzhu.book.mq;

import com.shanzhu.book.config.RabbitMQConfig;
import com.shanzhu.book.mapper.SeatReservationMapper;
import com.shanzhu.book.model.SeatReservation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class SeatMessageConsumer {

    @RabbitListener(queues = RabbitMQConfig.SEAT_RESERVATION_QUEUE)
    public void handleReservation(SeatReservation reservation) {
        // 处理预约逻辑（如写入数据库）
        System.out.println("收到预约消息: " + reservation);
    }

    @RabbitListener(queues = RabbitMQConfig.SEAT_CANCEL_QUEUE)
    public void handleCancel(Long reservationId) {
        // 处理取消逻辑
        System.out.println("收到取消消息: " + reservationId);
    }
}